package com.lyq.listener;

import com.lyq.permission.service.IPermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @Author:liangyunqian
 * @Date: 2022/12/13  10:44
 * @Description:
 */
@WebListener
public class PermissionScanListener implements ServletContextListener {
    @Autowired
    private IPermissionScanService permissionScanService;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("容器初始化开始===============");
        permissionScanService.scan();
        System.out.println("容器初始化结束===============");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("销毁容器=================");
    }
}
